<?php
/**
 * Created by dutuwang.net
 * User: adophper <hello@adophper.com>
 * Date: 2018/4/15
 * Time: 18:50
 */
use common\helpers\TStringHelper;
use common\services\ExhibitionHallServices;

$service = new ExhibitionHallServices();
$time = time();
?>
<div class="tab-pane active" id="city_<?=empty($regionId) ? '' : $regionId?>" xmlns="http://www.w3.org/1999/html">
    <?php
    if ($dataProvider->count > 0) {
        $row = $dataProvider->getModels();
        foreach ($row as $val) {
            $exhibition = $service->getHallExhibition($val['id'], 2, 'endtime desc');
    ?>
    <div class="hall-item clearfix">
        <div class="col-xs-4 col-md-4 img">
            <a href="<?=Yii::$app->urlManager->createUrl(['hall/detail', 'id' => $val['id']])?>"><img src="<?=$val['litpic']?>_285x225.jpg" alt="<?=$val['title']?>" /></a>
        </div>
        <div class="col-xs-8 col-md-8">
            <h3><a href="<?=Yii::$app->urlManager->createUrl(['hall/detail', 'id' => $val['id']])?>"><?=$val['title']?></a></h3>
            <div class="info">
                <span><i class="iconfont t_red">&#xe620;</i> <?=$val['address']?></span>
                <span><i class="glyphicon glyphicon-th t_red"></i> <?=$val['area']?>平方米</span>
            </div>
            <div class="intro">
                <p class="intro-read"><span>展馆介绍</span></p>
                <p class="intro-content"><?=TStringHelper::utf8_substr(strip_tags($val['introduce']), 0, 120, '...')?></p>
            </div>
            <?php
            if (!empty($exhibition)) {
            ?>
            <div class="hall-exhibition">
                <p class="intro-read"><span>近期展会</span></p>
                <div class="clearfix">
                    <?php
                    foreach ($exhibition as $item) {
                    ?>
                    <div class="hall-exhibition-item pull-left">
                        <div class="hall-exhibition-item-img pull-left img flex"><a href="<?=Yii::$app->urlManager->createUrl(['zhanhui/detail', 'id' => $item['id']])?>"><img src="<?=$item['logo']?>" /></a></div>
                        <div class="hall-exhibition-item-body pull-left">
                            <p class="hall-exhibition-item-title"><a href="<?=Yii::$app->urlManager->createUrl(['zhanhui/detail', 'id' => $item['id']])?>"><?=$item['title']?></a></p>
                            <p class="hall-exhibition-item-date">时间：
                                <?php
                                if ($item['endtime'] < $time) {
                                    echo Yii::t('frontend', 'finished');
                                }else{
                                    echo $item['show_start'].'—'.$item['show_end'];
                                }
                                ?>
                            </p>
                            <div class="clearfix"></div>
                        </div>
                    </div>
                    <?php
                    }
                    ?>
                </div>
            </div>
            <?php
            }
            ?>
        </div>
    </div>
    <?php
        }
    }
    ?>
    <div class="detailBox_whitemin list-page text-center">
        <?php
        echo \yii\widgets\LinkPager::widget([
            'pagination'=>$dataProvider->pagination,
            'maxButtonCount' => 6,
            'nextPageLabel' => Yii::t('frontend', 'next_page'),
            'prevPageLabel' => Yii::t('frontend', 'prev_page'),
            'firstPageLabel' => Yii::t('frontend', 'first_page'),
            'lastPageLabel' => Yii::t('frontend', 'last_page'),
        ]);
        ?>
    </div>
</div>
